package net.xiangcaowuyu.quartztask.job;

import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Date;

/**
 * @author laughing
 * @date 2020/9/30
 * @site https://www.lisen.org
 */
public class PrintJob implements Job {

    private final Logger logger = LoggerFactory.getLogger(PrintJob.class);

    /**
     * 执行任务
     *
     * @param jobExecutionContext
     * @throws JobExecutionException
     */
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        try {
            logger.info("Hello Job执行时间: " + new Date() + "  Blog:" + jobExecutionContext.getJobDetail().getJobDataMap().get("blog"));
            Thread.sleep(1000 * 5);
            System.out.println("================执行完成========================");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
